<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qclsampler.cpp -->
  <title>QCLSampler Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <script src="./scripts/superfish.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />  <script src="./scripts/narrow.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->
</head>
<body class="" onload="CheckEmptyAndLoadList();">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="150"><img src="images/qt-logo.png" align="left" border="0" />&nbsp;&nbsp;<img src="images/qtopencl-logo.png" border="0" /></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"> <a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="qtopencl-all-classes.html"><font color="#004faf">All Classes</font></a></td>
</table>              <li><a href="modules.html">Modules</a></li>              <li>QtCL</li>
              <li>QCLSampler</li>
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QCLSampler Class Reference</h1>
<!-- $$$QCLSampler-brief -->
<p>The QCLSampler class represents an OpenCL sampler object. <a href="#details">More...</a></p>
<!-- @@@QCLSampler -->
<pre class="highlightedCode brush: cpp">    #include &lt;QCLSampler&gt;</pre><p>This class was introduced in QtOpenCL 4.7.</p>
<ul>
<li><a href="qclsampler-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qclsampler.html#AddressingMode-enum">AddressingMode</a></b> { None, ClampToEdge, Clamp, Repeat }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qclsampler.html#FilterMode-enum">FilterMode</a></b> { Nearest, Linear }</td></tr>
</table>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qclsampler.html#QCLSampler">QCLSampler</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qclsampler.html#QCLSampler-2">QCLSampler</a></b> ( QCLContext * <i>context</i>, cl_sampler <i>id</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qclsampler.html#QCLSampler-3">QCLSampler</a></b> ( const QCLSampler &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qclsampler.html#dtor.QCLSampler">~QCLSampler</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QCLSampler::AddressingMode </td><td class="memItemRight bottomAlign"><b><a href="qclsampler.html#addressingMode">addressingMode</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QCLContext * </td><td class="memItemRight bottomAlign"><b><a href="qclsampler.html#context">context</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QCLSampler::FilterMode </td><td class="memItemRight bottomAlign"><b><a href="qclsampler.html#filterMode">filterMode</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qclsampler.html#isNull">isNull</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qclsampler.html#normalizedCoordinates">normalizedCoordinates</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> cl_sampler </td><td class="memItemRight bottomAlign"><b><a href="qclsampler.html#samplerId">samplerId</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qclsampler.html#operator-not-eq">operator!=</a></b> ( const QCLSampler &amp; <i>other</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QCLSampler &amp; </td><td class="memItemRight bottomAlign"><b><a href="qclsampler.html#operator-eq">operator=</a></b> ( const QCLSampler &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qclsampler.html#operator-eq-eq">operator==</a></b> ( const QCLSampler &amp; <i>other</i> ) const</td></tr>
</table>
<a name="details"></a>
<!-- $$$QCLSampler-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QCLSampler class represents an OpenCL sampler object.</p>
<p>Sampler objects define how to derive pixel values when an image is read by an OpenCL kernel.</p>
<p>The <a href="qclsampler.html#filterMode">filterMode</a>() defines how the pixel color should be derived. For example, reading the value at co-ordinates (3.2, 6.7) will read the nearest pixel value at (3, 7) if the <a href="qclsampler.html#filterMode">filterMode</a>() is <a href="qclsampler.html#FilterMode-enum">Nearest</a>, or will interpolate an intermediate color if the <a href="qclsampler.html#filterMode">filterMode</a>() is <a href="qclsampler.html#FilterMode-enum">Linear</a>.</p>
<p>The <a href="qclsampler.html#addressingMode">addressingMode</a>() defines how to handle out of bounds pixel accesses, by clamping to the range, repeating the image's pattern, etc.</p>
<p>Samplers are created using <a href="qclcontext.html#createSampler">QCLContext::createSampler</a>(), as follows:</p>
<pre class="highlightedCode brush: cpp">    QCLSampler sampler = context.createSampler
        (false, QCLSampler::ClampToEdge, QCLSampler::Linear);</pre>
<p>Samplers can also be defined as literals in the OpenCL kernel source code, which avoids the need to create an explicit QCLSampler value:</p>
<pre class="highlightedCode brush: cpp">    const sampler_t samp = CLK_ADDRESS_CLAMP_TO_EDGE |
                           CLK_FILTER_LINEAR;</pre>
<p>The main advantage of QCLSampler over literal sampler values is that QCLSampler allows the pixel derivation strategy to be modified at runtime.</p>
</div>
<!-- @@@QCLSampler -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$AddressingMode$$$None$$$ClampToEdge$$$Clamp$$$Repeat -->
<h3 class="fn"><a name="AddressingMode-enum"></a>enum QCLSampler::AddressingMode</h3>
<p>This enum specifies how to handle out-of-range image co-ordinates when reading from an image in OpenCL.</p>
<table class="valuelist"><tr class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td  class="topAlign"><tt>QCLSampler::None</tt></td><td class=" topAlign"><tt>0x1130</tt></td><td  class="topAlign">No special handling of out-of-range co-ordinates.</td></tr>
<tr><td  class="topAlign"><tt>QCLSampler::ClampToEdge</tt></td><td class=" topAlign"><tt>0x1131</tt></td><td  class="topAlign">Out-of-range requests clamp to the edge pixel value.</td></tr>
<tr><td  class="topAlign"><tt>QCLSampler::Clamp</tt></td><td class=" topAlign"><tt>0x1132</tt></td><td  class="topAlign">Out-of-range requests clamp to the image extents.</td></tr>
<tr><td  class="topAlign"><tt>QCLSampler::Repeat</tt></td><td class=" topAlign"><tt>0x1133</tt></td><td  class="topAlign">Repeats the image in a cycle.</td></tr>
</table>
<!-- @@@AddressingMode -->
<!-- $$$FilterMode$$$Nearest$$$Linear -->
<h3 class="fn"><a name="FilterMode-enum"></a>enum QCLSampler::FilterMode</h3>
<p>This enum defines the type of filter to apply when reading from an image in OpenCL.</p>
<table class="valuelist"><tr class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td  class="topAlign"><tt>QCLSampler::Nearest</tt></td><td class=" topAlign"><tt>0x1140</tt></td><td  class="topAlign">Use the color of the nearest pixel.</td></tr>
<tr><td  class="topAlign"><tt>QCLSampler::Linear</tt></td><td class=" topAlign"><tt>0x1141</tt></td><td  class="topAlign">Interpolate linearly between pixel colors to generate intermediate pixel colors.</td></tr>
</table>
<!-- @@@FilterMode -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QCLSampler[overload1]$$$QCLSampler -->
<h3 class="fn"><a name="QCLSampler"></a>QCLSampler::QCLSampler ()</h3>
<p>Constructs a null OpenCL sampler object.</p>
<!-- @@@QCLSampler -->
<!-- $$$QCLSampler$$$QCLSamplerQCLContext*cl_sampler -->
<h3 class="fn"><a name="QCLSampler-2"></a>QCLSampler::QCLSampler ( <a href="qclcontext.html">QCLContext</a> * <i>context</i>, cl_sampler <i>id</i> )</h3>
<p>Constructs an OpenCL sampler object from the native identifier <i>id</i>. This class takes over ownership of <i>id</i> and will release it in the destructor. The sampler <i>id</i> will be associated with <i>context</i>.</p>
<!-- @@@QCLSampler -->
<!-- $$$QCLSampler$$$QCLSamplerconstQCLSampler& -->
<h3 class="fn"><a name="QCLSampler-3"></a>QCLSampler::QCLSampler ( const QCLSampler &amp; <i>other</i> )</h3>
<p>Constructs a copy of <i>other</i>. The <tt>clRetainSampler()</tt> function will be called to update the reference count on <a href="qclsampler.html#samplerId">samplerId</a>().</p>
<!-- @@@QCLSampler -->
<!-- $$$~QCLSampler[overload1]$$$~QCLSampler -->
<h3 class="fn"><a name="dtor.QCLSampler"></a>QCLSampler::~QCLSampler ()</h3>
<p>Releases this OpenCL sampler object by calling <tt>clReleaseSampler()</tt>.</p>
<!-- @@@~QCLSampler -->
<!-- $$$addressingMode[overload1]$$$addressingMode -->
<h3 class="fn"><a name="addressingMode"></a><a href="qclsampler.html#AddressingMode-enum">QCLSampler::AddressingMode</a> QCLSampler::addressingMode () const</h3>
<p>Returns the addressing mode for out-of-range co-ordinates when reading from an image in OpenCL.</p>
<p>See also <a href="qclsampler.html#normalizedCoordinates">normalizedCoordinates</a>() and <a href="qclsampler.html#filterMode">filterMode</a>().</p>
<!-- @@@addressingMode -->
<!-- $$$context[overload1]$$$context -->
<h3 class="fn"><a name="context"></a><a href="qclcontext.html">QCLContext</a> * QCLSampler::context () const</h3>
<p>Returns the OpenCL context that this sampler was created for; null if not yet created within a context.</p>
<!-- @@@context -->
<!-- $$$filterMode[overload1]$$$filterMode -->
<h3 class="fn"><a name="filterMode"></a><a href="qclsampler.html#FilterMode-enum">QCLSampler::FilterMode</a> QCLSampler::filterMode () const</h3>
<p>Returns the type of filter to apply when reading from an image in OpenCL.</p>
<p>See also <a href="qclsampler.html#normalizedCoordinates">normalizedCoordinates</a>() and <a href="qclsampler.html#addressingMode">addressingMode</a>().</p>
<!-- @@@filterMode -->
<!-- $$$isNull[overload1]$$$isNull -->
<h3 class="fn"><a name="isNull"></a>bool QCLSampler::isNull () const</h3>
<p>Returns true if this OpenCL sampler object is null; false otherwise.</p>
<!-- @@@isNull -->
<!-- $$$normalizedCoordinates[overload1]$$$normalizedCoordinates -->
<h3 class="fn"><a name="normalizedCoordinates"></a>bool QCLSampler::normalizedCoordinates () const</h3>
<p>Returns true if this sampler is using normalized co-ordinates; false otherwise.</p>
<p>See also <a href="qclsampler.html#addressingMode">addressingMode</a>() and <a href="qclsampler.html#filterMode">filterMode</a>().</p>
<!-- @@@normalizedCoordinates -->
<!-- $$$samplerId[overload1]$$$samplerId -->
<h3 class="fn"><a name="samplerId"></a>cl_sampler QCLSampler::samplerId () const</h3>
<p>Returns the native OpenCL identifier for this sampler; or 0 if the sampler is null.</p>
<!-- @@@samplerId -->
<!-- $$$operator!=[overload1]$$$operator!=constQCLSampler& -->
<h3 class="fn"><a name="operator-not-eq"></a>bool QCLSampler::operator!= ( const QCLSampler &amp; <i>other</i> ) const</h3>
<p>Returns true if this OpenCL sampler object is not the same as <i>other</i>; false otherwise.</p>
<p>See also <a href="qclsampler.html#operator-eq-eq">operator==</a>().</p>
<!-- @@@operator!= -->
<!-- $$$operator=[overload1]$$$operator=constQCLSampler& -->
<h3 class="fn"><a name="operator-eq"></a>QCLSampler &amp; QCLSampler::operator= ( const QCLSampler &amp; <i>other</i> )</h3>
<p>Assigns <i>other</i> to this OpenCL sampler object. The current <a href="qclsampler.html#samplerId">samplerId</a>() will be released with <tt>clReleaseSampler()</tt>, and the new <a href="qclsampler.html#samplerId">samplerId</a>() will be retained with <tt>clRetainSampler()</tt>.</p>
<!-- @@@operator= -->
<!-- $$$operator==[overload1]$$$operator==constQCLSampler& -->
<h3 class="fn"><a name="operator-eq-eq"></a>bool QCLSampler::operator== ( const QCLSampler &amp; <i>other</i> ) const</h3>
<p>Returns true if this OpenCL sampler object is the same as <i>other</i>; false otherwise.</p>
<p>See also <a href="qclsampler.html#operator-not-eq">operator!=</a>().</p>
<!-- @@@operator== -->
</div>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td align="left">Copyright &copy; 2010 Nokia Corporation</td>
<td align="right">QtOpenCL Documentation</td>
</tr></table></div></address>  <script src="scripts/functions.js" type="text/javascript"></script>
  <script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-4457116-5']);
  _gaq.push(['_trackPageview']);
  (function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
  </script>
</body>
</html>
